package com.genersoft.iot.vmp.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;

import java.util.List;

/**
 * 级联国标平台关联流业务接口
 */
public interface IGbStreamService extends IService<GbStream> {

    /**
     * 分页获取所有
     * @param page
     * @param entity
     * @return
     */
    Page<GbStream> getAll(Page page, GbStream entity);

    /**
     * 移除
     * @param app
     * @param stream
     */
    int del(String app, String stream);

    /**
     * 保存国标关联
     * @param gbStreams
     */
    boolean addPlatformInfo(List<GbStream> gbStreams, String platformId, String catalogId);

    /**
     * 移除国标关联
     * @param gbStreams
     * @param platformId
     */
    boolean delPlatformInfo(String platformId, List<GbStream> gbStreams);

    DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform);

    void sendCatalogMsg(GbStream gbStream, String type);

    void sendCatalogMsgs(List<GbStream> gbStreams, String type);

    /**
     * 修改gbId或name
     * @param streamPushItemForUpdate
     * @return
     */
    int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);

    DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);

    /**
     * 查询所有未分配的通道
     * @param platformId
     * @return
     */
    List<GbStream> getAllGBChannels(String platformId);

    /**
     * 移除所有关联的通道
     * @param platformId
     * @param catalogId
     */
    void delAllPlatformInfo(String platformId, String catalogId);

    List<GbStream> getGbChannelWithGbid(String gbId);

    boolean updateByAppAndStream(GbStream gbStream);

    GbStream selectByAppAndStream(String app, String stream);

    void deleteWithoutGBId(String type, String mediaServerId);
}
